package parse;

import java.util.List;
import SystemManagement.SM_Manager;
import Const.Constant;

public class Update extends SQL{
	public String relName;
	public Condition conditions;
	public List<new_value> valuelist;
	
	public Update(String rel, new_valuelist v, Condition condition){
		this.relName = rel;
		this.valuelist = v.value_list;
		this.conditions = condition;
	}
	
	public LQPlan CrtAgbPlan(SM_Manager sm){
		try{
			sm.CheckTable(relName);
		}
		catch(Error e){
			throw e;
		}
		
		AlgebraTable table = new AlgebraTable(this.relName);
		Sigma sigma = new Sigma(this.conditions, table);
		return new LQPlan(new Update_LQplan(valuelist, sigma));
	}
}
